//
//  cnhbMsgAlert.h
//  HousingPoliceAssistant
//
//  Created by 云警01 on 2019/6/6.
//  Copyright © 2019 盛洋. All rights reserved.
//

#import <UIKit/UIKit.h>

#define btnFont @"HelveticaNeue-Bold"
#define btnHeight 45.0

typedef NS_ENUM(NSInteger, AlertViewType) {
    Message,
    Alert,
    HtmlAlert,
    ImageAlert
};

typedef NS_ENUM(NSInteger, AlertViewActionType) {
    None,
    Selector,
    Closure
};

typedef NS_ENUM(NSInteger, AlertAnimationType) {
    ScrollFromUp,
    ScaleZoomIn,
    ScalePop,
    FadeIn
};

@class cnhbMsgAlert;
@protocol cnhbMsgAlertDelegate <NSObject>

@optional

- (void)alertWillShow:(cnhbMsgAlert * __nullable)alert;
- (void)alertDidShow:(cnhbMsgAlert * __nullable)alert;
- (void)alertWillClose:(cnhbMsgAlert * __nullable)alert;
- (void)alertDidClose:(cnhbMsgAlert * __nullable)alert;

@end

@class cnhbMsgAlertButton;
typedef void (^TouchButton)(cnhbMsgAlertButton *__nullable);

@interface cnhbMsgAlertButton : UIButton

@property (nonatomic, assign) AlertViewActionType actionType;
@property (nonatomic, strong) id __null_unspecified target;
@property (nonatomic, assign) SEL __nullable selector;
//@property (nonatomic, copy) void (^ __null_unspecified action)(void);
@property (nonatomic, copy) TouchButton __nullable actionBlock;
- (nonnull instancetype)initWithFrame:(CGRect)frame;
- (nullable instancetype)initWithCoder:(NSCoder * __nullable)aDecoder;

@end

@interface cnhbMsgAlert : UIViewController

@property (nonatomic, strong) UIColor * __nullable btnTitleColor;
@property (nonatomic) CGFloat top;
@property (nonatomic) CGFloat left;
@property (nonatomic) CGFloat width;
@property (nonatomic) CGFloat height;
@property (nonatomic, strong) UIFont * __nullable font;
@property (nonatomic, strong) UIColor * __nullable textColor;
@property (nonatomic, strong) UIColor * __nullable titleColor;
@property (nonatomic, strong) UIColor * __nullable msgTextColor;
@property (nonatomic, strong) UIColor * __nullable shadowBackgroundColor;
@property (nonatomic, strong) UIColor * __nullable backgroundColor;

@property (nonatomic, strong) UIView * __nullable alertShadowView;//底部透明层
@property (nonatomic, strong) UIView * __nullable alertView;//对话框层
@property (nonatomic, strong) UILabel * __nullable titleLabel;//对话框标题
@property (nonatomic, strong) UILabel * __nullable viewLabel;//对话框内容
@property (nonatomic, strong) UIImageView * __nullable imgView;
@property (nonatomic, strong) UIActivityIndicatorView * __nullable activityIndicatorView;
@property (nonatomic, strong) UITextView * __nullable textView;
@property (nonatomic, strong) UIView * __nullable rootView;
//@property (nonatomic, strong) cnhbMsgAlertButton * __nullable buttons;

@property (nonatomic, strong) NSTimer * __nullable msgTimer;
@property (nonatomic, retain) NSMutableArray * __nullable buttons;
@property (nonatomic) NSTimeInterval msgTimeInterval;
@property (nonatomic, copy) NSString * __nullable alertAnimateType;
@property (nonatomic) BOOL isShowOther;
@property (nonatomic, strong) cnhbMsgAlertButton * __nullable closeImageButton;
@property (nonatomic, weak) id <cnhbMsgAlertDelegate> __nullable delegate;
@property (nonatomic) BOOL isKeyBoardShow;

//- (nullable instancetype)initWithCoder:(NSCoder * __nonnull)aDecoder;
//- (nonnull instancetype)initWithNibName:(NSString * __nullable)nibNameOrNil bundle:(NSBundle * __nullable)nibBundleOrNil;
- (void)showMessage:(NSString * __nullable)contentText;
- (void)showMessage:(NSString * __nullable)contentText withTimer:(NSTimeInterval)times;
- (void)showAlertTitle:(NSString * __nullable)title contentText:(NSString * __nullable)contentText;
- (void)showAlertTitle:(NSString * __nullable)title contentText:(NSString * __nullable)contentText completeText:(NSString * __nullable)completeText;
- (void)showAlertTitle:(NSString * __nullable)title contentText:(NSString * __nullable)contentText width:(CGFloat)width;
- (void)showAlertTitle:(NSString * __nullable)title contentText:(NSString * __nullable)contentText completeText:(NSString * __nullable)completeText width:(CGFloat)width height:(CGFloat)height;
//- (void)showImageAlert:(NSString * __nullable)imageUrl;
//- (void)showHtmlAlert:(NSString * __nullable)title contentText:(NSString * __nullable)contentText;
//- (void)showHtmlAlert:(NSString * __nullable)title contentText:(NSString * __nullable)contentText completeText:(NSString * __nullable)completeText;
//- (void)showHtmlAlert:(NSString * __nullable)title contentText:(NSString * __nullable)contentText completeText:(NSString * __nullable)completeText width:(CGFloat)width height:(CGFloat)height;
- (void)showConfirm:(NSString * __nullable)title contentText:(NSString * __nullable)contentText cancelButton:(NSString * __nullable)cancelTitle infoDic:(NSDictionary *__nullable)infoDic action:(TouchButton __nullable)action;
- (void)viewWillLayoutSubviews;
- (cnhbMsgAlertButton * __nullable)addButton:(NSString * __nullable)title action:(TouchButton __nullable)action;
- (cnhbMsgAlertButton * __nullable)addButton:(NSString * __nullable)title target:(id __nullable)target selector:(SEL __null_unspecified)selector;
- (void)buttonTapped:(cnhbMsgAlertButton * __nullable)btn;
- (void)buttonTapDown:(cnhbMsgAlertButton * __nullable)btn;
- (void)buttonRelease:(cnhbMsgAlertButton * __nullable)btn;
- (void)hideView;
- (void)hideMessage;

@end
